package cn.edu.scau.cmi.xuandingcong.simpleFactoryMethod;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;

public class SimpleFactoryDomain {
	@FXML
	private TextArea ta ;
	@FXML
	private ComboBox combobox;
	@FXML
	private Button b1 ;
	MeatFactory meatFactory ;
	public void simpleFactoryDomain() {
		b1.setOnAction(new EventHandler<ActionEvent>() {
			
			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				if(combobox.getValue().equals("生产猪肉")) {
					ta.appendText(meatFactory.factory("Pork").Operation()+"\n");
					}
				if(combobox.getValue().equals("生产牛肉")) {
					ta.appendText(meatFactory.factory("Beef").Operation()+"\n");
					}
				if(combobox.getValue().equals("生产鸡肉")) {
					ta.appendText(meatFactory.factory("Chicken").Operation()+"\n");
					}	
			
				}
			});
		
	}
}
